package org.zjh.controller.listener;

import org.zjh.controller.GameController;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * @description: 修改玩家信息确认按钮监听
 * @author 郑佳豪
 * @date 2024/10/2 17:42
 * @version 1.0
 */
public class UpdatePlayerOkLis extends MouseAdapter {

    private static final UpdatePlayerOkLis updatePlayerOkJbtLis = new UpdatePlayerOkLis();
    private String account;
    private String nickname;
    private String correctAnswer1;
    private String correctAnswer2;


    private UpdatePlayerOkLis(){}


    @Override
    public void mouseClicked(MouseEvent e) {
        //调用Controller的更新用户信息方法
        GameController.getInstance().updateUserInfo(account,nickname,correctAnswer1,correctAnswer2);
    }

    /**
     * 获取实例对象
     * @return UpdatePlayerOkJbtLis实例对象
     */
    public static UpdatePlayerOkLis getInstance(){
        return updatePlayerOkJbtLis;
    }


    public void setCorrectAnswer1(String correctAnswer1) {
        this.correctAnswer1 = correctAnswer1;
    }

    public void setCorrectAnswer2(String correctAnswer2) {
        this.correctAnswer2 = correctAnswer2;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }
}
